package Pricelist.API
{
	import com.adobe.crypto.MD5;
	//import com.adobe.serialization.json.JSON;

	public class VKAPIHelper	
	{
		
		private const keyString:String = "";
		
		protected var apiUrl : String;
		protected var apiId : Number; 
		protected var viewerId:String;
		protected var isAppUser:String;
		protected var viewerType:Number;
		protected var apiResult:String;
		protected var apiSettings:Number;		

		protected var albumId :String;

        public function fillApiData():void
        {
     		var root:flash.display.DisplayObject = SystemManager.getSWFRoot(this);
     		
			apiUrl      = root.loaderInfo.parameters.api_url;
			apiId       = root.loaderInfo.parameters.api_id;
			viewerId    = root.loaderInfo.parameters.viewer_id;
			isAppUser   = root.loaderInfo.parameters.is_app_user;
			viewerType  = root.loaderInfo.parameters.viewer_type;
			apiResult   = root.loaderInfo.parameters.api_result;
			apiSettings = root.loaderInfo.parameters.api_settings;

        }
		public function VKAPIHelper()
		{
			fillApiData();
		}
		
		private function makeSignature(methodName:String):String
		{
			var parameterString: String;
			parameterString = viewerId;
			
			if (albumId != null)
			{
			   parameterString += "aid=" + albumId;
			}
			parameterString += "api_id=" + apiId;
			parameterString += "method=" + methodName;
			parameterString += "v=3.0"+ keyString;
			return MD5.hash(parameterString);
		}


	}
}